<?php
    $loginInformation = file_get_contents('usernamesAndPasswords.txt');
    $usersInfo = array_filter(explode(PHP_EOL, $loginInformation));
    $wrongData = TRUE;
    foreach($usersInfo as $infoLine)
    {
        $usernameAndPassword = explode('|', $infoLine);
        if($usernameAndPassword[0] == $username and $usernameAndPassword[1] == $password)
        {
            $_SESSION['username'] = $username;
            $_SESSION['password'] = $password;
            $wrongData = FALSE;
            break;
        }
    }
?>